<?php

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Auth::routes();

Route::middleware(['auth', 'checkProfile'])->group(function () {
    // PC
    // Route::get('/', 'HomeController@index')->name('home');
    Route::get('/', 'IndexController@index')->name('home'); // PC 首页换成 H5 首页

    Route::get('/test', 'TestController@index')->name('test');
    Route::post('/answer/{id}', 'AnswerController@index')->name('answer');
    Route::get('/score', 'ScoreController@index')->name('score');

    // H5
    Route::get('/index', 'IndexController@index')->name('index');
    Route::get('/grade', 'GradeController@index')->name('grade');
    Route::get('/guide', 'GuideController@index')->name('guide');
    Route::get('/rank', 'RankController@index')->name('rank');
    Route::get('/zice', 'ZiceController@index')->name('zice');
    Route::get('/guess', 'GuessController@index')->name('guess');
    Route::post('/submit', 'ZiceController@submit')->name('submit');
});

// 设置个人信息
Route::get('/profile', 'ProfileController@index')->name('profile.show');
Route::post('/profile', 'ProfileController@update')->name('profile.update');

Route::get('/share/{url}', 'ShareController@share')->name('share');
Route::get('/avatars', 'AvatarListController@index')->name('avatars');

// 微信登录
Route::get('login/wechat', 'Auth\LoginController@redirectToProvider')->name('login.wechat');
Route::get('login/wechat/callback', 'Auth\LoginController@handleProviderCallback')->name('login.wechat.callback');

Route::get('/getWxAuthUrl', 'Api\LoginController@getWxAuthUrl')->name('getWxAuthUrl');
Route::get('/getUserInfoByWxMpCode', 'Api\LoginController@getUserInfoByWxMpCode')->name('getUserInfoByWxMpCode');

// 微信
Route::get('/jssdk', 'WeChatController@jssdk')->name('jssdk');
